package com.situ.gym.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.situ.gym.pojo.Reserve;
import com.situ.gym.mapper.ReserveMapper;
import com.situ.gym.pojo.query.ReserveQuery;
import com.situ.gym.pojo.vo.DayCountVO;
import com.situ.gym.pojo.vo.ReserveVO;
import com.situ.gym.service.IReserveService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2025-08-22
 */
@Service
public class ReserveServiceImpl extends ServiceImpl<ReserveMapper, Reserve> implements IReserveService {
    
    @Autowired
    private ReserveMapper reserveMapper;

    @Override
    public IPage<ReserveVO> list(ReserveQuery reserveQuery) {
        IPage<ReserveVO> page = new Page<>(reserveQuery.getPage(), reserveQuery.getLimit());
        return reserveMapper.list(page, reserveQuery);
    }

    @Override
    public void deleteAll(Long[] ids) {
        reserveMapper.deleteAll(ids);
    }

    @Override
    public List<DayCountVO> selectReserveCount(Date date) {
        return reserveMapper.selectReserveCount(date);
    }
    
    @Override
    public List<DayCountVO> selectUserPersonalReserve(Date date, Integer userId) {
        return reserveMapper.selectUserPersonalReserve(date, userId);
    }
    
    @Override
    public Long selectUserPersonalReserveTotal(Integer userId) {
        return reserveMapper.selectUserPersonalReserveTotal(userId);
    }
    
    @Override
    public List<DayCountVO> selectCoachPersonalReserve(Date date, Integer coachId) {
        return reserveMapper.selectCoachPersonalReserve(date, coachId);
    }
    
    @Override
    public Long selectCoachReserveTotal(Integer coachId) {
        return reserveMapper.selectCoachReserveTotal(coachId);
    }
}
